home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / MacDrawPro.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  8.7 KB  |  215 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        MacDrawPro.vu
  5. #
  6. #    Contains:    Quick look test script for MacDraw Pro version 1.5
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.6>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  19. #                                    launchTwitch().
  20. #     <1.0.5>     9/28/93    KTA        Added returnVal for ModifyDocument hook.
  21. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  22. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  23. #
  24. # ****************************************************************************
  25. #
  26.  
  27.  
  28.  
  29. ########################################################################
  30. #                            External libraries 
  31. #=======================================================================
  32. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  33.  
  34.  
  35. #########################################################################
  36. ########               Application Specific Tasks
  37. #########################################################################
  38.  
  39. #########################################################################
  40. #                        InitAppGlobals()
  41. #========================================================================
  42. # Author:        ML
  43. # Description:    Sets up tools and fonts for MacDraw Pro.  This task
  44. #                must be called first.
  45. # Parameters:    None
  46. # Returns:        Nothing
  47. # Examples:        InitAppGlobals()
  48. #========================================================================
  49. # History:
  50. #
  51. ########################################################################
  52. task InitAppGlobals()
  53. begin
  54.     
  55.     logstr("setting up {global gApptitle}'s globals");            
  56.     global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
  57.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  58.     global kToolPaletteNum := 1; 
  59.     global kColorPaletteNum := 2;
  60.     global kPatternPaletteNum := 3;
  61.     global kGradientPaletteNum := 4;
  62.  
  63.     global gWindowInset := {27,41,20,20};    # Window inset
  64.     global gScreenInset := {0,20,0,0};        # Screen inset
  65.     global gVoidRect := {};                    # Rect not to draw in - coordinates should be RelativeToWindow
  66.     global gLineWeights := {'1 point','2 point','4 point','6 point','8 point','10 point'};
  67.     global gTextStr;
  68.     
  69.     global gPaletteList :=    {
  70.                             {                        #### Start Palette #1 - Tools
  71.                             {0, 21, 25, 228,0},        # Location of palette relative to the window
  72.                                                     # top is in first tool because it is larger
  73.                             kPalDocWind,            # Palette type
  74.                             {1,12},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  75.                             {0,17}                    # Offset between tools {h,v}
  76.                             },                        #### End Palette #1
  77.                             {                        #### Start Palette #2 - Colors
  78.                             {152, 29, 148, 44,0},        # PopPoint, TopLeft of first color (if 4 item list - coords are absolute)
  79.                                                     #                  (if 5 item list - coords are relativeToWindow )
  80.                             kPopUpPal,                # Palette type
  81.                             {21,8},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  82.                             {10,10}                    # Offset between tools {h,v}
  83.                             },                        #### End Palette #2
  84.                             {                        #### Start Palette #3 - Pattern
  85.                             {175, 28, 176, 46,0},        # PopPoint, TopLeft of first pattern (if 4 item list - coords are absolute)
  86.                                                     #                  (if 5 item list - coords are relativeToWindow )
  87.                             kPopUpPal,                # Palette type
  88.                             {8,8},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  89.                             {16,16}                    # Offset between tools {h,v}
  90.                             },                        #### End Palette #3
  91.                             {                        #### Start Palette #4 - Gradient
  92.                             {200, 28, 198, 47,0},        # PopPoint, TopLeft of first gradient (if 4 item list - coords are absolute)
  93.                                                     #                  (if 5 item list - coords are relativeToWindow )
  94.                             kPopUpPal,                # Palette type
  95.                             {8,2},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  96.                             {16,16}                    # Offset between tools {h,v}
  97.                             }                        # End Palette #4
  98.     };
  99.  
  100.     ### MacDraw Pro                                                                        {Flag, Pattern, Line, Color}
  101.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  102.     global SelectTool         :=     { 1,  1,         "Select",    kClick,     0,                {0}                };
  103.     global CharTool         :=     { 2,  1,         "Char",        kDrag,         0,                {gTextStr,0,0,1}};
  104.     global LineTool         :=     { 3,  1,         "Line",        kDrag,         0,                {1,0,1,0}        };
  105.     global RectTool         :=     { 4,  1,        "Rectangle",kDrag,        0,                {1,1,1,1}        };
  106.     global RndRectTool         :=     { 5,  1,         "RndRect",    kDrag,        0,                {1,1,1,1}        };
  107.     global OvalTool         :=     { 6,  1,        "Oval",        kDrag,         0,                {1,1,1,1}        };
  108.     global ArcTool             :=     { 7,  1,         "Arc",        kDrag,         0,                {2,1,1,1}        };
  109.     global FreeTool         :=     { 8,  1,         "Freehand",    kMultiDrag, 0,                {2,1,1,1}        };
  110.     global PolyTool         :=     { 9,  1,         "Polygon",    kMultiClick,1,                {2,1,1,1}        };
  111.     global BezTool             :=     { 10, 1,         "BezTool",    kMultiClick,1,                {2,1,1,1}        };
  112.     global NoteTool         :=     { 11, 1,         "Note",        kDrag,         0,                {gTextStr}        };
  113.     global ColorPickerTool     :=     { 12, 1,         "ColorPicker",    kClick, 0,                {0}                };
  114.     global PenLine             :=     { '', {87,29,1}, "PenLine",        0,         0,                {0}                };
  115.     global ZoomOut             :=     { '', {30,-8,2}, "ZoomOut",        0,         0,                {0}                };
  116.  
  117.     # global Tool list
  118.     global gToolList:={    SelectTool, 
  119.                         CharTool,
  120.                         LineTool,
  121.                         RectTool,
  122.                         RndRectTool,
  123.                         OvalTool,
  124.                         ArcTool,
  125.                         FreeTool,
  126.                         PolyTool,
  127.                         BezTool,
  128.                         NoteTool,
  129.                         ColorPickerTool
  130. };
  131.  
  132.         ### font characteristic lists
  133.     global gFontSizeList := {'9','10','12','14','18', '24','36','48'};
  134.     global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow', 'Superscript','Subscript','–Small Caps'};
  135.  
  136.         ### Name of the Plain (style) menu item  ####
  137.     global gPlainStyle := "Plain Text";            # Plain-Style menu item
  138.  
  139.         ### How to get to the next line
  140.     global gNextLineMethod := 1;            
  141.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  142.     
  143.         ### Does moving to the next line clear all font info
  144.     global gNextLineClearsFontSettings := 0;                        
  145.  
  146. end;    #InitMacDrawProTools
  147.  
  148. #########################################################################
  149. #                            MacDrawModifyDocument()
  150. #========================================================================
  151. # Author:        ML
  152. # Description:    Modify MacDraw Document
  153. # Parameters:    None
  154. # Returns:        Nothing
  155. # Examples:        MacDrawModifyDocument();
  156. # Assumptions:    None 
  157. # Applications:    MacDraw Pro
  158. #========================================================================
  159. # History:
  160. #
  161. #########################################################################
  162. task MacDrawModifyDocument()
  163. begin
  164.     return(Scrapbook(global kScrapPict));
  165. end;
  166.  
  167. #########################################################################
  168. #                            MacDrawSetupDoText()
  169. #========================================================================
  170. # Author:        ML
  171. # Description:    Sets up DoText
  172. # Parameters:    None
  173. # Returns:        Nothing
  174. # Examples:        MacDrawSetupDoText();
  175. # Assumptions:    None 
  176. # Applications:    MacDraw Pro
  177. #========================================================================
  178. # History:
  179. #
  180. #########################################################################
  181. task MacDrawSetupDoText()
  182. begin
  183.     logstr("Setting up for DoText...");
  184.     SetTool(global SelectTool);        # Deselects any selected objects 
  185. end;
  186.  
  187. ################################################################################
  188. ####################             Main script                    ####################
  189. ################################################################################
  190. script MacDrawPro (ScriptLevel:= -1)
  191. begin
  192.     InitGlobals(ScriptLevel);                                # initialize your general globals
  193.     InitDraw();
  194.     InitFonts();
  195.     global gApptitle := "MacDraw Pro";
  196.     global gAppVersion := '1.5';                        # version of app you will be running
  197.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    # This is used in SaveAs when saving files
  198.     SuiteStart('MacDrawPro.vu');                                        # begin a new test suite
  199.     if LaunchTwitch("{gAppTitle}",gAliasDirectory)         # launch or twitch to your app
  200.     begin
  201.         global gModifyDocument:= task MacDrawModifyDocument; # define app specific task
  202.         global gSetLine := Task SetLineMenuItems;        # Requires VU 2.0
  203.         global gSetupDoText:= task MacDrawSetupDoText;    # define app specific task
  204.         InitAppGlobals();                                # init app specific globals
  205.         (*
  206.         *)
  207.         DoSetUpApp(,,,,1,1,1);
  208.         DoDraw();
  209.         DoText();
  210.         DoWindow();
  211.         DoCloseApp(1);
  212.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  213.     SuiteEnd();
  214. end; # script MacDrawPro
  215. # Need to add views